<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=building-width, initial-scale=1, maximum-scale=1">
    <% include("/templates/common/header.html"){} %>
    <!-- jqgrid-->
    <link href="${ctxPath!}/css/bootstrap.css?v=3.3.6" rel="stylesheet">
    <link href="${ctxPath!}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${ctxPath!}/jqgrid/jqgrid.css" rel="stylesheet">
    <style>
        .ui-jqgrid-btable tbody tr td{
            vertical-align: middle!important;
        }
    </style>
</head>
<body>
<div class="content-search">
    <div class="content-search">
        <form action="${ctxPath!}/sys/worker/download" id="download" method="GET"></form>
        <form id="search" class="layui-form layui-form-pane" lay-filter="form">
            <div class="layui-inline" style="margin-left: 10px;padding: 12px;">
                <div class="layui-input-inline">
                    <input type="text" id="keyword" autocomplete="off" class="layui-input" placeholder="请输入姓名关键字" onchange="search()">
                </div>
            </div>
            <div class="layui-inline">
                <atom:auth type="button" perm="sys:worker:upgrade"  iconText="&#xe615;" onclick="return search();" text=" 搜索"/>
            </div>
        </form>
    </div>

</div>
<!-- 内容主体区域 -->
<div style="padding: 2px;">
    <div class="jqGrid_wrapper">
        <table id="table"></table>
        <div id="pager" ></div>
    </div>
</div>
</div>
<script src="${ctxPath!}/jquery/jquery.min.js?v=2.2.4"></script>
<script src="${ctxPath!}/jquery/jquery.form.js?v=3.50.0"></script>
<script src="${ctxPath!}/jqgrid/i18n/grid.locale-cnffe4.js?0820"></script>
<script src="${ctxPath!}/jqgrid/jquery.jqGrid.minffe4.js?0820"></script>
<script src="${ctxPath!}/jqgrid/frozen.js?v=1.0.1"></script>
<script src="${ctxPath!}/jqgrid/myjqGrid.js"></script>
<script src="${ctxPath!}/layui/layui.js"></script>
<script>

    layui.use('form', function(){
    });

    var colNames = ["ID","orgID","职员名称" ,"职位名称","现等级","下一等级","离晋升还需月数","操作"];
    var colModel = [{
        name : "id",
        index : "id",
        width : 50,
        hidden: true,
        align : "left"
    },{
        name : "orgId",
        index : "orgId",
        width : 50,
        hidden: true,
        align : "left"
    },{
        name : "username",
        index : "username",
        sortable : false,
        width : 50,
        align : "center"
    },{
        name : "jobName",
        index : "jobName",
        sortable : false,
        width : 50,
        align : "center"
    },{
        name : "workerLevel",
        index : "workerLevel",
        sortable : false,
        width : 50,
        align : "center"
    },{
        name : "nextWorkerLevel",
        index : "nextWorkerLevel",
        sortable : false,
        width : 50,
        align : "center",
    },{
        name : "needUpgradeMonths",
        index : "needUpgradeMonths",
        sortable : false,
        width : 50,
        align : "center"
    },{
        name : "action",
        index : "action",
        width : 50,
        title:false,
        editable:true,
        align : "center",
        formatter : function(cellvalue, options, rowdata){
            var html="";
            if(rowdata.needUpgradeMonths != null && rowdata.needUpgradeMonths == 0){
                html = '<atom:auth type="button" perm="sys:promotionLog:edit" extClass="btn-edit" iconText="&#xe642;" dataId="' + rowdata.id + '" text="晋升" />';
            }
            return html;
        }
    }];

    var myJqGrid = null;
    $(document).ready(function () {
        myJqGrid = new MyJqGrid({
            jqGrid_id: 'table',
            data: "${ctxPath!}/sys/worker/upgrade.json",
            isSubGrid: false,
            autowidth: true,
            shrinkToFit: true,
            autoScroll: true,
            colNames: colNames,
            colModel: colModel
        })
    });
    $(function(){

        $(document).on("click", ".btn-edit", function (e) {
            var index =layer.open({
                title: '育婴师晋升',
                type: 2,
                content: '${ctxPath!}/sys/promotionLog/edit?id='+$(this).data("id"),
                maxmin: true
            });
            layer.full(index);

        });
    });
    function search(){
        myJqGrid.reloadGrid({"keyword":$("#keyword").val()});
        return false;
    }

</script>
</body>
</html>